/**
 * 
 */
package info.sswap.ontologies.modularity;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.URI;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

/**
 * A simple Java bean to hold the information regarding the input and output of a module extraction request
 * 
 * @author Pavel Klinov
 *
 */
public class ModuleExtraction {

	private URI mOntoURI = null;
	private Set<URI> mSignature = null;
	private Module mModule = null;

	protected ModuleExtraction(URI ontoURI, Collection<URI> signature) {
		mOntoURI = ontoURI;
		mSignature = new HashSet<URI>(signature);
	}
	
	public URI getOntologyURI() {
		return mOntoURI;
	}
	
	public void setOntologyURI(URI ontoURI) {
		mOntoURI = ontoURI;
	}
	
	public Set<URI> getSignature() {
		return mSignature;
	}
	
	public void setSignature(Set<URI> sig) {
		mSignature = sig;
	}
	
	public Module getModule() {
		return mModule;
	}
	
	public void setModule(Module module) {
		mModule = module;
	}
	
	public String getModuleAsString() {
		ByteArrayOutputStream stream = new ByteArrayOutputStream();
		
		try {
			mModule.write(stream);
			stream.flush();
			stream.close();
		} catch (IOException e) {
			return e.getMessage();
		}
		
		return stream.toString();
	}
}
